import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../model/config.dart';

import '../commit/badge.dart';

class MsgUserItem extends StatelessWidget {
  Map msgUser;
  Function onClick;
  MsgUserItem({
    Key key,
    @required this.msgUser,
    this.onClick
  }):super(key:key);
  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        height: ScreenUtil().setWidth(130),
        child: Row(
          children: <Widget>[
            Container(
              margin: EdgeInsets.all(ScreenUtil().setWidth(22)),
              width: ScreenUtil().setWidth(86),
              height: ScreenUtil().setWidth(86),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(50),
                image: DecorationImage(
                  image: NetworkImage(
                    msgUser['headimgurl']
                  )
                )
              ),
            ),
            Expanded(
              child: Padding(
                padding: EdgeInsets.only(
                  top: ScreenUtil().setWidth(22),
                  right: ScreenUtil().setWidth(20),
                  bottom: ScreenUtil().setWidth(22),
                ),
                child: Column(
                  children: <Widget>[
                    Container(
                      height: ScreenUtil().setWidth(34),
                      child: Row(
                        children: <Widget>[
                          Expanded(
                            child: Text(
                              msgUser['nickname'],                              
                              maxLines: 1,overflow: TextOverflow.clip,
                              style: TextStyle(
                                fontSize: ScreenUtil().setWidth(26),
                                color: Color.fromRGBO(1, 1, 1, 1),
                                fontWeight: FontWeight.w600
                              ),
                            ),
                          ),
                          Padding(
                            child: Text(
                              '11:02',
                              style: TextStyle(
                                fontSize: ScreenUtil().setWidth(22),
                                color: Color.fromRGBO(123, 123, 123, 1),
                              ),
                            ),
                            padding: EdgeInsets.only(
                              top: ScreenUtil().setWidth(12),
                            ),
                          )
                        ],
                      ),
                    ),
                    Container(
                      margin: EdgeInsets.only(top: ScreenUtil().setWidth(14)),
                      height: ScreenUtil().setWidth(32),
                      child: Row(
                        children: <Widget>[
                          Expanded(
                            child: Text(
                              '按时打卡是多久啊是觉得哈十九大受打击啊按时打卡是多久啊是觉得哈十九大受打击啊',
                              maxLines: 1,
                              overflow: TextOverflow.ellipsis,
                              style: TextStyle(
                                color: Color.fromRGBO(140, 140, 140, 1),
                                fontSize: ScreenUtil().setWidth(25), 
                              ),
                            ),
                          ),
                          Badge(num: msgUser['newNum'])
                        ],
                      ),
                    )
                  ],
                ),
              ),
            )
          ],
        ),
      ),
      onTap: onClick,
    );
  }
}